const Router = require("koa-router");
const dayjs = require("dayjs");
const db = require("../../sql/mysql");
let router = new Router();

router.post("/api/add", async (ctx) => {
  console.log(ctx.request.body);
  let { pageNum, pageSize } = ctx.request.body;
  let param = {
    activityID: new Date().getTime(),
    activeClassID: 1,
    userID: 123,
    activityName: 1,
    initiator: 1,
    descriptions: 1,
    is_charge: 1,
    price: 1,
    is_shelves: 1,
    gmt_create: dayjs(`${new Date()}`).format("YYYY-MM-DD HH:mm:ss"),
  };

  let result = await db.insert("activity", param);

  ctx.body = {
    result,
  };
});

module.exports = router;
